﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Team4Mock.Entity;
namespace Team4Mock.UserControl.TrustRegion
{
    public partial class AddTrustRegion : System.Web.UI.UserControl
    {
        TrustRegionEntity te=new TrustRegionEntity();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }
        }
        protected void btnBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("/FormView/TrustRegion.aspx");
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (txtRegionName.Text == "")
            {
                tb.Text = "Input Region Name";
            }
            else
            {
                try
                {
                    te.TrusRegionName = txtRegionName.Text;
                    te.CountryID = dlNation.SelectedValue;
                    te.IsActive = ckisactive.Checked ? 1 : 0;
                    te.Description = txtDes.Text;
                    te.Insert(te);
                    tb.Text = "Insert Success";
                }
                catch
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "Error();", true);
                }
            }
        }
    }
}